﻿using MediatR;
using S.ReportForms.Domain.Dto;
using S.ReportForms.Infrastructure.Interface;
using static S.ReportForms.Read.API.Application.Command.HomeProductionWarningAllCommand;

namespace S.ReportForms.Read.API.Application.CommandHandlers
{
    /// <summary>
    /// 首页生产警告
    /// </summary>
    public class HomeProductionWarningAllCommandHandler : IRequestHandler<HomeProductionWarningCommand, List<HomeProductionWarningDto>>
    {
        #region 注入
        private readonly IHomeProductionWarningRepository repository;
        public HomeProductionWarningAllCommandHandler(IHomeProductionWarningRepository repository)
        {
            this.repository = repository;
        }
        #endregion

        /// <summary>
        /// 获取首页生产警告的数据
        /// </summary>
        /// <returns></returns>
        public async Task<List<HomeProductionWarningDto>> Handle(HomeProductionWarningCommand request, CancellationToken cancellationToken)
        {
            return await repository.GetHomeProductionWarning();
        }
    }
}
